package com.gang.mars.basic.reflection;

import java.io.FileInputStream;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Properties;

public class Cat1 {

    public static void main(String[] args) throws IOException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException {

        Properties properties = new Properties();
        properties.load(new FileInputStream("D:\\2022\\source\\gang-mars-java\\spring-boot-basic\\src\\re.properties"));
        String packageStr = properties.get("package").toString();
        String methodStr = properties.get("method").toString();

        Class<?> aClass = Class.forName(packageStr);

        Method method = aClass.getMethod(methodStr);

        Object o = aClass.newInstance();

        method.invoke(o);
    }
}
